J = "aA"
S = "aAAbbbb"

result = len([c for c in S if c in set(J)])
print(result)